<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;

//测试控制器
class RegisteredController extends Controller{
    //注册
    public function index(){
    	if(IS_POST){
	 		//接受密码，邮箱
			$password=Q('post.password');
			$password2=Q('post.password2');
			$uemail = Q('post.uemail');
			//判断 验证
			if($password!=$password2){
				View::error('两次输入的密码不正确');
			}elseif(strtoupper(Q('post.code'))!=Code::get()){
				View::error('输入验证码错误');
			}
			//实例化模型
			$regModel=new \Common\Model\User;
			if(!$regModel->store($uemail,$password)){
				View::error($regModel->getError());
			}
			View::success('注册成功',U('Registered/index'));
    	}
       View::make();
    }
	//验证码
	public function code(){
	    Code::num('4')->fontColor('blue')->make();
	}
}